package internal

import (
	"go.uber.org/zap"
	"gogogo-server/clientmock/game"
	"gogogo-server/engine/cororpc"
	"gogogo-server/engine/module"
	"gogogo-server/protocol"
)

type ClientMockGate struct {
	*module.LGGate
}

func (cmg *ClientMockGate) OnInit() error {
	cmg.LGGate = module.GateInstance()
	serverLink := cmg.LGGate.GetClient("serverlink")
	if nil == serverLink {
		zap.S().Fatal("配置不对,没有连接服务器的地址")
	}
	serverLink.MsgProcessor.RegisterRouter(protocol.MsgEventHelloWorld, &protocol.HelloWorld{}, game.Module.GetServerCoroRPC())
	serverLink.MsgProcessor.RegisterRouter("NewAgent", nil, game.Module.GetServerCoroRPC())
	serverLink.MsgProcessor.RegisterRouter("CloseAgent", nil, game.Module.GetServerCoroRPC())
	return nil
}

func (cmg *ClientMockGate) AfterInit() error {
	return nil
}
func (cmg *ClientMockGate) GetServerCoroRPC() *cororpc.RPCServer {
	return nil
}

func (cmg *ClientMockGate) OnDestroy() {}
